package plus.decl;

import java.util.*;

public final class DeclBucket {
	private List<D_TypeDef> typedefs = new LinkedList<D_TypeDef>();
	private List<D_Record> records = new LinkedList<D_Record>();
//	private List<D_Given> givens = new LinkedList<D_Given>();
	private List<D_Function> fnDefs = new LinkedList<D_Function>();
	private List<D_Var> varDecls = new LinkedList<D_Var>();
	public void declare(Declaration d) {
		// Sort the declarations into their appropriate bins.
		if (d instanceof D_Record)   records.add((D_Record) d);
		else if (d instanceof D_TypeDef)       typedefs.add((D_TypeDef) d);
//		else if (d instanceof D_Given)    givens.add((D_Given) d);
		else if (d instanceof D_Function) fnDefs.add((D_Function) d);
		else if (d instanceof D_Var)      varDecls.add((D_Var) d);
		else assert false;
	}
	public List<D_Record> records() { return records; }
	public List<D_Function> fnDefs() { return fnDefs; }
	public List<D_Var> varDecls() { return varDecls; }
	public List<D_TypeDef> typeDefs() { return typedefs; }
}
